Skip to content

fix: add secrets validation and harden deploy workflow - #3

Draft
mudabs with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-deploy-to-vps
Draft

mudabs with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-deploy-to-vps

Conversation

Copilot AI commented Jul 28, 2026 •

Copy link
Copy Markdown

The "Deploy to VPS" job was failing immediately with Error: missing server host because VPS_HOST, VPS_USER, and VPS_SSH_KEY secrets were not configured — ${{ secrets.XXX }} silently resolves to empty strings, giving the SSH action no connection parameters.

There was also a secondary bug: cd ${{ secrets.VPS_APP_DIR }} collapses to bare cd when the secret is unset, silently navigating to $HOME instead of the app directory.

Changes

  • Added "Validate required secrets" step — checks VPS_HOST, VPS_USER, VPS_SSH_KEY via env vars before attempting SSH; emits a ::error:: annotation listing missing secrets and fails fast with an actionable message instead of a cryptic SSH error.
  • Removed VPS_APP_DIR secret dependency — replaced with the hardcoded path ~/apps/eventshare documented in DEPLOYMENT_STEPS.md. This value is not secret; making it a secret only introduced a silent failure mode.
- name: Validate required secrets
  run: |
    missing=()
    [[ -z "$VPS_HOST" ]]    && missing+=(VPS_HOST)
    [[ -z "$VPS_USER" ]]    && missing+=(VPS_USER)
    [[ -z "$VPS_SSH_KEY" ]] && missing+=(VPS_SSH_KEY)
    if [[ ${#missing[@]} -gt 0 ]]; then
      echo "::error::Required secrets are not set: ${missing[*]}"
      echo "Configure them in Settings → Secrets and variables → Actions"
      exit 1
    fi
  env:
    VPS_HOST: ${{ secrets.VPS_HOST }}
    VPS_USER: ${{ secrets.VPS_USER }}
    VPS_SSH_KEY: ${{ secrets.VPS_SSH_KEY }}

Note: The deploy will still fail until VPS_HOST, VPS_USER, and VPS_SSH_KEY are configured under Settings → Secrets and variables → Actions. This PR ensures the failure is loud and actionable rather than opaque.

Copilot AI changed the title [WIP] Fix failing GitHub Actions job Deploy to VPS fix: add secrets validation and harden deploy workflow Jul 28, 2026
Copilot AI requested a review from mudabs July 28, 2026 01:19

@mudabs mudabs left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secrets stored on server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants